Skip to content

test(a11y): lock in reduced-motion scroll + focus-not-obscured regressions#1048

Merged
BigSimmo merged 3 commits into
mainfrom
claude/a11y-playwright-focus-motion-123366
Jul 21, 2026
Merged

test(a11y): lock in reduced-motion scroll + focus-not-obscured regressions#1048
BigSimmo merged 3 commits into
mainfrom
claude/a11y-playwright-focus-motion-123366

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Regression coverage for the two accessibility fixes shipped in #1036, so they cannot silently regress. Test-only — no product code changes.

  • ANIM-01 (WCAG 2.3.3 — animation from interactions): a live Chromium test in ui-accessibility.spec.ts wraps Element.prototype.scrollTo/scrollIntoView to record the behavior argument each scripted scroll receives, then triggers a known one ("New chat"). Under a reduced-motion preference every scripted scroll must be an instant "auto" jump; with no preference the same action animates ("smooth"). This verifies resolveScrollBehavior() is actually threaded through the call sites, not merely unit-tested in isolation.
  • A11Y-FOCUS-01 (WCAG 2.4.11 — focus not obscured): a deterministic source pin (dashboard-scroll-padding.test.ts) asserts #main-content reserves scroll-padding-bottom in both mobile dock branches (and the answer-view scroll-padding-top). The reservation only renders in app states that are impractical to reach reliably in a browser test (an answer-with-content view requires a mocked streaming answer), so it is pinned at source — the repo's established pattern for phone scroll-geometry invariants (see mobile-interaction-regressions.test.ts).

Verification

  • npm run typecheck, npm run lint, npm run format:check
  • npm run test — full unit + jsdom suite: 348 files / 3108 passed / 0 failed (includes the new dashboard-scroll-padding.test.ts)
  • npm run verify:ui — full Chromium UI lane green (265 passed), including the new ANIM-01 reduced-motion scroll test

Risk and rollout

  • Risk: none. Test-only; adds one Playwright test and one source-pin unit test, no product code touched.
  • Rollback: revert this commit.
  • Provider or production effects: None. Verification was fully offline (local dev server only).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added coverage to verify scripted scrolling honors the user’s reduced-motion preference (no “smooth” motion when reduced).
    • Added checks to ensure the dashboard’s scroll container uses the correct overflow and scroll padding for keyboard focus.
    • Verified small-screen layout spacing reserves space for the docked composer.

…sions

Guard the two accessibility fixes shipped in #1036 against regression:

- ANIM-01 (WCAG 2.3.3): a live Chromium test intercepts the behaviour argument
  every scripted scrollTo/scrollIntoView receives, then triggers a known scroll
  ("New chat"). Reduced motion must produce instant "auto" jumps; no-preference
  must animate ("smooth") — verifying resolveScrollBehavior() is threaded through
  the call sites, not just unit-tested in isolation.
- A11Y-FOCUS-01 (WCAG 2.4.11): a deterministic source pin asserts #main-content
  reserves scroll-padding-bottom in both mobile dock branches (plus the answer
  scroll-padding-top). The reservation only renders in app states impractical to
  reach reliably in a browser test, so it is pinned at source — the repo's
  established pattern for phone scroll-geometry invariants.

Verified: typecheck, lint, format:check, full unit+jsdom suite (348 files /
3108 passed / 0 failed), and both targeted tests green against the local server.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@supabase

supabase Bot commented Jul 21, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 889a5f01-a22c-41d9-8780-215b0d4c999c

📥 Commits

Reviewing files that changed from the base of the PR and between b588253 and 15f1986.

📒 Files selected for processing (1)
  • tests/dashboard-scroll-padding.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/dashboard-scroll-padding.test.ts

📝 Walkthrough

Walkthrough

Adds tests for ClinicalDashboard scroll-padding invariants and verifies scripted scrolling uses auto under reduced motion and smooth otherwise.

Changes

Scroll accessibility validation

Layer / File(s) Summary
Dashboard scroll geometry invariants
tests/dashboard-scroll-padding.test.ts
Adds source-based assertions for the #main-content scroll container, mobile composer reservations, and safe-area-aware top scroll padding.
Reduced-motion scripted scrolling
tests/ui-accessibility.spec.ts
Records scrollTo and scrollIntoView behavior and verifies motion preference-specific scrolling behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: codex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the added accessibility regression tests for reduced-motion scrolling and focus visibility.
Description check ✅ Passed The description includes summary, verification, and risk/rollback; the unused clinical governance checklist is not applicable to this test-only PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/a11y-playwright-focus-motion-123366

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/dashboard-scroll-padding.test.ts`:
- Around line 33-37: Update the test assertions around the reserve string in the
dashboard scroll-padding test to verify the matching content-padding pair
appears in both dock branches, rather than only asserting one occurrence. Keep
the existing occurrence count and ensure each reservation is paired with
max-sm:pb-[var(--mobile-composer-reserve)].
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f1230468-c80a-48d8-b81e-9d0b0f8fd2ee

📥 Commits

Reviewing files that changed from the base of the PR and between ba7a569 and b588253.

📒 Files selected for processing (2)
  • tests/dashboard-scroll-padding.test.ts
  • tests/ui-accessibility.spec.ts

Comment thread tests/dashboard-scroll-padding.test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c0898d9da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/dashboard-scroll-padding.test.ts Outdated
…oth dock branches

Address the review findings on the A11Y-FOCUS-01 source pin:
- Bind every assertion to the extracted `<main id="main-content">` opening tag
  instead of counting source-wide occurrences, so a reservation class that drifts
  onto a child or a non-scrolling wrapper now fails the guard (a `>` inside a
  className comment means the tag is read up to its line-final `>`).
- Require the *paired* `pb` + `scroll-padding-bottom` reservation in both dock
  branches (>=2), so one branch losing its content padding no longer passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LRZ1EyBZW1ADXrZvMxEEsC
@BigSimmo
BigSimmo merged commit f85c09b into main Jul 21, 2026
42 checks passed
@BigSimmo
BigSimmo deleted the claude/a11y-playwright-focus-motion-123366 branch July 21, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants